/*
 * Class to track the last unit addressed for a given houseCode.
 * Used for RJ and PL commands that are multipart where the address
 * is transmitted first/separate from the device code
 */

package x10.interfaces.cm15a.receive;

import java.util.HashMap;
import x10.enums.Device;
import x10.enums.House;

/**
 *
 * @author Denny
 */
public class LastAddressedTracker {
    HashMap<House, Device> lastAddressed;

    public LastAddressedTracker(){
        lastAddressed = new HashMap<House, Device>();
    }

    public Device getLastAddressed(House houseCode){
        if(lastAddressed.containsKey(houseCode)){
            return lastAddressed.get(houseCode);
        } else {
            return Device.DUNK;  //Device Unknown
        }
    }

    public void setLastAddressed(House houseCode, Device deviceCode){
        lastAddressed.put(houseCode, deviceCode);
    }

}
